import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import API from '@/api'
import Count from './components/Count'

function App() {
  const getToken = async () => {
    try {
      // const res = API.billList.login(JSON.stringify({loginName: 'admin', loginPwd: '123456'}))
      const res = API.billList.getToken({loginName: 'admin', loginPwd: '123456'})
      console.log('getToken', res);
    } catch (error) {
      console.log('getToken error', error);
    }
  }

  const getUserList = async () => {
    const res = await API.billList.getGithubUser('1')
    console.log(res);
  }
  const a = {}

  const onChange1 = (value: number, stateValue: number) => {console.log('onAdd111', value, stateValue)}
  const onChange2 = (value: number, stateValue: number) => {console.log('onAdd111', value, stateValue)}

  return (
    <>
      <div>
        <a href="https://vitejs.dev" target="_blank">
          <img src={viteLogo} className="logo" alt="Vite logo" />
        </a>
        <a href="https://react.dev" target="_blank">
          <img src={reactLogo} className="logo react" alt="React logo" />
        </a>
      </div>
      <h1>Vite + React</h1>
      <div className="card">
        {/* <button onClick={getToken}>获取token</button>
        <button onClick={getUserList}>获取getUserList</button> */}
        <Count startValue={1} onChange={onChange1} />
        <Count startValue={100} onChange={onChange2} />
        <p>
          Edit <code>src/App.tsx</code> and save to test HMR
        </p>
      </div>
      <p className="read-the-docs">
        Click on the Vite and React logos to learn more
      </p>
    </>
  )
}

export default App
